<?xml version="1.0" encoding= "UTF-8"?>
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">

<ui:composition template="/templates/common.xhtml">
	<ui:define name="content">
		<h:form>
			<p:panel id="newUserPanel" header="New user of Social Network">
				<h:panelGrid columns="2" cellpadding="5">
					<h:message for="firstName" showSummary="true" />
					<h:messages showDetail="true" />
					<p:outputLabel for="firstName" value="First Name:" />
					<p:inputText id="firstName" value="#{userBean.self.firstName}"
						required="true" label="First name: "
						requiredMessage="Name is required.">
						<f:validateLength minimum="3" maximum="15" />
					</p:inputText>

					<p:outputLabel for="lastName" value="Last Name" />
					<p:inputText id="lastName" value="#{userBean.self.lastName}"
						required="true" label="Last name: ">

					</p:inputText>


					<p:outputLabel for="gender" value="Gender:" />
					<p:selectOneRadio id="gender" value="#{userBean.self.gender}"
						layout="grid" columns="1">
						<f:selectItem itemLabel="Man" itemValue="MALE" />
						<f:selectItem itemLabel="Woman" itemValue="FEMALE" />
						<f:selectItem itemLabel="Unknown" itemValue="UNKNOWN" />
					</p:selectOneRadio>


					<p:outputLabel for="birthday" value="Birthday: " />
					<p:calendar id="birthday" value="#{userBean.self.birthdayDate}"
						label="Birthday">
					</p:calendar>
					<p:outputLabel for="website" value="Web site:" />
					<p:inputText id="website" value="#{userBean.self.webSite}" />

					<p:outputLabel for="phone" value="Phone:" />
					<p:inputText id="phone" value="#{userBean.self.phone}"
						label="Phone">
					</p:inputText>


					<p:outputLabel for="country" value="Country: " />
					<p:selectOneMenu id="country" style="width:150px"
						value="#{userBean.country}" effect="fade"
						converter="countryConverter">

						<f:selectItem itemLabel="Select Country" itemValue="" />
						<f:selectItems value="#{locationBean.getCountryList()}"
							var="country" itemLabel="#{country.countryName}"
							itemValue="#{country}" />

					</p:selectOneMenu>



					<p:outputLabel for="address" value="Address:" />
					<p:inputText id="address" value="#{userBean.self.address}">
					</p:inputText>
				</h:panelGrid>
				<p:commandButton value="Save" action="#{userBean.saveUser}"
					update="newUserPanel">
				</p:commandButton>
				<p:commandButton value="Reset" type="reset" />
				<br />
				<br />

			</p:panel>

		</h:form>


	</ui:define>

</ui:composition>


</html>
